# -*- encoding: utf-8 -*-
'''
@File		:	venus.py
@Time		:	2024/01/18 17:50:24
@Author		:	dan
@Description:	本实例演示测试浏览器登录功能
'''




if __name__ == '__main__':
    import sys
    sys.path.append(".")
import matter
import matter.browser


@matter.test_case(name='登录')
def login():
    # 输入账号

    xpath_username = '/html/body/div/div/div[1]/div[2]/div[2]/div[1]/div[2]/div/form/div[1]/div/div/div/div/input'
    matter.browser.touch_by_xpath(xpath_username)
    matter.browser.input('admin')

    xpath_password = '/html/body/div/div/div[1]/div[2]/div[2]/div[1]/div[2]/div/form/div[2]/div/div/div/div/input'
    matter.browser.touch_by_xpath(xpath_password)
    matter.browser.input('123456')

    xpath_login = '/html/body/div/div/div[1]/div[2]/div[2]/div[1]/div[2]/div/form/div[3]/div[2]/div/div/button'
    matter.browser.touch_by_xpath(xpath_login)
    matter.sleep(10)

    xpath_success = '/html/body/div[1]/div/div/section/header/div[1]/div/div[2]/div/button[2]/span/span'
    login_success = matter.browser.exist_xpath(xpath_success)
    matter.assert_true(login_success)


if __name__ == '__main__':
    matter.start(yml='demo/browser/matter.venus.yml')